<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <link rel="shortcut icon" href="images/favicon.ico"/>
        <title>JForum :: #{resourcesController.extractResource('USER_DATA')}</title>
    </h:head>
    <h:body style="background-color: #111111">
        
       <div id="header">
		<ui:insert name="header" >
			<ui:include src="header.xhtml" />
		</ui:insert>
       </div>
        
       <center>
          
           <p:panel header="#{resourcesController.extractResource('USER_DATA')} #{authorizationBean.user.username}" 
                       style="width:790px">
                  <div align="center">
                    <h:form>
                      
                      #{userInfoBean.initUserParameters(authorizationBean.user)}
                        
                      <p:graphicImage url="#{userInfoBean.avatarPath}"
                                      width="100px"
                                      style="border-color: black; float:left; margin-left: 50px"/>
                      
                      
                      <h:panelGrid cellspacing="5"
                                   cellpadding="5"
                                   columns="2"> 
                          
                          <h:outputText value="#{resourcesController.extractResource('EMAIL')}: " />  
                          <p:inplace id="email" editor="true">  
                              <p:inputText value="#{userInfoBean.email}"  
                                            required="false" 
                                            label="text" />  
                          </p:inplace>  

                          <h:outputText value="#{resourcesController.extractResource('PASSWORD_CHANGE')}: " />  
                          <p:inplace id="password" 
                                     label="***************" 
                                     editor="true">  
                              <h:inputSecret value="#{userInfoBean.password}"  
                                             required="false" 
                                             label="text"/>  
                          </p:inplace> 

                          <h:outputText value="#{resourcesController.extractResource('MESSAGES_COUNT')}: " />  
                          <h:outputText value="#{userInfoBean.messagesCount}"/>  
                          
                      </h:panelGrid>
                      
                      
                    </h:form>
                    <h:form enctype="multipart/form-data"> 
                         <p:fileUpload fileUploadListener="#{userInfoBean.handleFileUpload}"
                                              style="margin-top: 10px"
                                              cancelLabel="#{resourcesController.extractResource('ABORT')}"
                                              uploadLabel="#{resourcesController.extractResource('UPLOAD')}"
                                              label="#{resourcesController.extractResource('SELECT_NEW_AVATAR')}"
                                              allowTypes="/(\.|\/)(png)$/"
                                              mode="advanced"
                                              update="@all"
                                              sizeLimit="100000"
                                              invalidSizeMessage="#{resourcesController.extractResource('ILLEGAL_IMAGE_SIZE')}"
                                              invalidFileMessage="#{resourcesController.extractResource('ILLEGAL_IMAGE_FORMAT')}"/>
                    </h:form>
                    <h:form>
                          <br/>
                          <p:commandButton value="#{resourcesController.extractResource('SAVE_CHANGES')}"
                                           action="userinfo.xhtml?faces-redirect=true"
                                           actionListener="#{userInfoBean.applyChanges(authorizationBean.user)}"
                                           ajax="false"
                                           async="true"/>
                    </h:form>  
                        
                 </div>
                 
            </p:panel>
          
        </center> 
        <ui:insert name="header" >
			<ui:include src="footer.xhtml" />
        </ui:insert>
    </h:body>
</html>

